<!DOCTYPE html>

<head>
  <meta http-equiv="Content-Security-Policy" content="require-trusted-types-for 'script';">
  <meta name="theme-color" content="#1976d2">

  <!-- Google tag (gtag.js) -->
  <!--
    Modified to:
     * Support selecting tag ID base on the host.
     * Work with trusted types.
     * Anonymize IP address.
  -->
  <script>
    // Select a tag ID based on the host.
    const isProd = self.location.host === 'ci.chromium.org'
      // This is not perfect but works well with all the cases we have.
      // Given that the tag IDs are public, there's no point protecting against
      // LUCI UI being hosted on weird domains.
      || self.location.host.includes('luci-milo.');
    const tagId = isProd ? 'G-59XDL10QJF' : 'G-DZFV9Q535L';

    // Load gtag.js.
    const gtagJs = `https://www.googletagmanager.com/gtag/js?id=${tagId}`;
    const trustedGtagJs = self.trustedTypes
      ?.createPolicy('luci-ui-gtag-js', { createScriptURL: (_) => gtagJs })
      .createScriptURL('') || gtagJs;
    const gtagScript = document.createElement('script')
    gtagScript.async = true;
    gtagScript.src = trustedGtagJs;
    const firstScriptTag = document.getElementsByTagName('script')[0];
    firstScriptTag.parentNode.insertBefore(gtagScript, firstScriptTag);

    // Install gtag.
    window.dataLayer = window.dataLayer || [];
    function gtag() { dataLayer.push(arguments); }
    gtag('js', new Date());
    gtag('config', tagId, {
      // Anonymize IP to comply with http://go/ooga-config#ip-scrubbing.
      anonymize_ip: true,
      // We track page view event during route initialization. This gives us
      // more control and allows us to attach more metadata.
      //
      // Disable the automatic page view measurement here to avoid double
      // measurement. Browser history based tracking should also be disable via
      // the Google Analytics console.
      send_page_view: false,
    });
  </script>
  <!-- End Google Tag -->

  <meta charset="utf-8">
  <title>LUCI</title>
  <!--
    data-react-helmet="true" is needed for this value to be overridden properly.
    See https://github.com/nfl/react-helmet/issues/430#issuecomment-520364492.
  -->
  <link rel="preconnect" href="https://fonts.googleapis.com">
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
  <link rel="icon" data-react-helmet="true" href="/src/common/assets/favicons/milo-32.png" >
  <link rel="stylesheet" href="/src/common/styles/style.css">
  <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Material+Icons&display=block">
  <link href="https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">

  <script type="module" src="/src/main.tsx" defer></script>
  <script src="https://www.gstatic.com/feedback/js/help/prod/service/lazy.min.js" defer></script>
</head>

<body>
  <script>
    // Load GAPI client.
    function gapiLoad() {
      gapi.load('client', function () {
        gapi.client.init({})
      })
    }
  </script>
  <script async defer src="https://apis.google.com/js/api.js" onload="gapiLoad()"></script>
  <div id="app-root"></div>
</body>
